package com.gitee.wsl.logger

import java.io.PrintWriter
import java.io.StringWriter

internal fun debugLog(msg:String){
    if(!Logger.isDebug)return
    println("[OTLogger][Debug]：${msg}")
}

internal fun errorLog(msg:String){
    if(!Logger.isDebug)return
    println("[OTLogger][Error]：${msg}")
}

fun Thread.stringify(): String {
    return "$name:$id"
}

private const val INITIAL_BUFFER_SIZE = 256

fun Throwable.stringify(): String {
    // Don't replace this with Log.getStackTraceString() - it hides
    // UnknownHostException, which is not what we want.
    val sw = StringWriter(INITIAL_BUFFER_SIZE)
    val pw = PrintWriter(sw, false)
    printStackTrace(pw)
    pw.flush()
    return sw.toString()
}

actual val platformLogPainter: LogPrinter
    get() = ConsoleLogPrinter.instant